﻿<div id="divOffictControl" style="display:none; width:100%;height:100%">

    <script>
        var ProductCaption = '@ViewData["ProductCaption"]';
        var ProductKey = '@ViewData["ProductKey"]';
        savecode = rootPath + "/Admin/DocumentPub/Save";
    </script>

    <script src="@Url.Content("~/Scripts/ntkoofficecontrol.js", true)" type="text/javascript"></script>

    <!--控件事件代码开始-->

    <script type="text/javascript" language="JScript" for="TANGER_OCX" event="OnFileCommand(cmd,canceled);">
	                alert(cmd);
	                CancelLastCommand=true;
    </script>

    <script type="text/javascript" language="JScript" for="TANGER_OCX" event="OnDocumentClosed();">
	                setFileOpenedOrClosed(false);
    </script>

    <script type="text/javascript" language="JScript" for="TANGER_OCX" event="OnDocumentOpened(TANGER_OCX_str,TANGER_OCX_obj);">
	                //saved属性用来判断文档是否被修改过,文档打开的时候设置成ture,当文档被修改,自动被设置为false,该属性由office提供.	                
	                TANGER_OCX_OBJ.ActiveDocument.Saved = true;
	                
	                if(2==TANGER_OCX_OBJ.DocType)
	                {
	                
	                    try{
	                        TANGER_OCX_OBJ.ActiveDocument.Application.ActiveWorkbook.Saved=true;
	                    }catch(e)
	                    {
	                        alert("错误：" + err.number + ":" + err.description);
	                    }
	                 }
	                setFileOpenedOrClosed(true);//设置文档状态值
		            controlStyle();//插入控件样式自定义菜单
		            SetReviewMode(false);//设置文档在痕迹模式下编辑
		       
    </script>

    <script type="text/javascript" language="JScript" for="TANGER_OCX" event="BeforeOriginalMenuCommand(TANGER_OCX_str,TANGER_OCX_obj);">
	                alert("BeforeOriginalMenuCommand事件被触发");
    </script>

    <script type="text/javascript" language="JScript" for="TANGER_OCX" event="OnFileCommand(TANGER_OCX_str,TANGER_OCX_obj);">
	                if (TANGER_OCX_str == 3) 
	                {
		                alert("不能保存！");
		                CancelLastCommand = true;
	                }
    </script>

    <script language="JScript" for="TANGER_OCX" event="OnCustomMenuCmd2(menuPos,submenuPos,subsubmenuPos,menuCaption,menuID)">
		            //alert("第" + menuPos +","+ submenuPos +","+ subsubmenuPos +"个菜单项,menuID="+menuID+",菜单标题为\""+menuCaption+"\"的命令被执行.");
		            if("全网页查看"==menuCaption)objside();
		            if("恢复原大小"==menuCaption)objside2();
    </script>

    <script type="text/javascript" language="JScript" for="TANGER_OCX" event="AfterPublishAsPDFToURL(result,code);">
	                result=trim(result);
	                alert(result);
	                if(result=="succeed")
	                {window.close();}
    </script>

    <!--控件事件代码结束-->
</div>
